﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Pyramid.Extentions;

namespace Pyramid.Models
{
	/// <summary>
	/// 公司员工
	/// </summary>
	public class Staff
	{
		public int Id { get; set; }

		[Display(Name = "工号")]
		[MaxLength(20)]
		public string Code { get; set; }

		[Display(Name = "姓名")]
		[MaxLength(20)]
		public string FullName { get; set; }

		[Display(Name = "性别")]
		public int Gender { get; set; }

		[NotMapped]
		public Genders GenderEnum
		{
			get { return (Genders) Gender; }
		}

		[NotMapped]
		public string GenderString
		{
			get { return ((Genders) Gender).ToDescription(); }
		}

		[Display(Name = "出生日期")]
		public DateTime Birthday { get; set; }

		[Display(Name = "身份证号")]
		[MaxLength(20)]
		public string IdCard { get; set; }

		[Display(Name = "移动电话")]
		[MaxLength(20)]
		public string Mobile { get; set; }

		[Display(Name = "家庭住址")]
		[MaxLength(50)]
		public string HomeAddress { get; set; }

		[Display(Name = "担任职务")]
		public int PositionId { get; set; }

		[Display(Name = "个人简介")]
		[MaxLength(200)]
		public string BriefIntro { get; set; }

		[Display(Name = "入职日期")]
		public DateTime EntryDate { get; set; }

		[Display(Name = "建档日期")]
		public DateTime CreateTime { get; set; }

		[Display(Name = "建档人")]
		[MaxLength(20)]
		public string CreateUserId { get; set; }

		[Display(Name = "最后修改时间")]
		public DateTime EditTime { get; set; }

		[Display(Name = "最后修改人")]
		[MaxLength(20)]
		public string EditUserId { get; set; }

		[Display(Name = "所在部门")]
		public int DepartmentId { get; set; }

		[Display(Name = "状态")]
		public int Status { get; set; }

		public StaffStatus StatusEnum
		{
			get { return (StaffStatus) Status; }
		}

		[Display(Name = "登录账号")]
		[MaxLength(20)]
		public string UserId { get; set; }

		[ForeignKey("DepartmentId")]
		public virtual Department Department { get; set; }

		[ForeignKey("PositionId")]
		public virtual StaffPosition Position { get; set; }

		public virtual ICollection<StaffSalarySetMaster> StaffSalarySetMasters { get; set; }
		public virtual ICollection<AttendanceDetail> AttendanceDetails { get; set; }
	}
}